package com.lagou.service.impl;

import com.lagou.common.CityProvinceConverter;
import com.lagou.common.ServerResponse;
import com.lagou.mapper.CountryMapMapper;
import com.lagou.service.ICountryMapService;
import com.lagou.vo.CityVo;
import com.lagou.vo.ProvinceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CountryMapServiceImpl implements ICountryMapService {
    @Autowired
    private CountryMapMapper countryMapMapper;

    @Override
    public ServerResponse<List<ProvinceVo>> getCountryMap() {
        List<ProvinceVo> provinceVos = countryMapMapper.getCountryMap();
        List<CityVo> cityVos = countryMapMapper.getCityNum();
        List<ProvinceVo> provinceVo = CityProvinceConverter.converter(cityVos,provinceVos);
        return ServerResponse.createBySuccessData(provinceVo);
    }
}
